from django.http import HttpResponse
from django.shortcuts import render


# Create your views here.

def index_demo(request):
    return HttpResponse('git测试')

def index(request):
    return HttpResponse('路由测试')


def special_case_2022(request):
    return HttpResponse('special_case_2022')


def year_archive(request, year):
    return HttpResponse(f"year_archive:{year}")


def month_archive(request, year, month):
    return HttpResponse(f"month_archive 年：{year} 月：{month}")


def article_detail(request, year, month, slug):
    return HttpResponse(f"article_detail 年：{year} 月：{month} {slug}")

def articles_str(request, city):
    print("city的类型", type(city))
    return HttpResponse(f'articles_str-->{city}')

def articles_slug(request, title):
    print("title的类型", type(title))
    return HttpResponse(f'articles_slug-->{title}')

def articles_path(request, path):
    print("path的类型", type(path))
    return HttpResponse(f'articles_path-->{path}')

#------------------正则匹配相关的函数-------------------------

def re_special_case_2021(request):
    return HttpResponse('re_special_case_2021')

def re_year_archive(request, year):
    return HttpResponse(f"re_year_archive:{year}")

def re_month_archive(request, year, month):
    return HttpResponse(f"re_month_archive 年：{year} 月：{month}")
def re_article_detail(request, year, month, slug):
    return HttpResponse(f"article_detail 年：{year} 月：{month} {slug}")

# 传递额外参数
def blog_year_archive(request,year,major,info):
    return HttpResponse(f"blog_year_archive--year:{year}  major:{major}  info:{info}")